import { defHttp } from '@/utils/http';

// 分页查询项目
export const getProjectManagementPage = (
  data: ProjectManagement.Request & { condition: Partial<ProjectManagement.ProjectQuery> },
) => defHttp.post({ url: '/devops/projectManagement/page', data });

// 查询所有项目类型
export const getProjectTypeList = () => defHttp.get({ url: `/devops/projectManagement/project-type/find-all` });

// 获取所有用户
export const getUserList = () => defHttp.post({ url: `/devops/api/sys/user/findUserList` });

// 新增项目
export const addProjectData = (data: ProjectManagement.AddRequestData) =>
  defHttp.post({ url: `/devops/projectManagement/create`, data });

// 更新项目
export const putProjectData = (data: ProjectManagement.AddRequestData) =>
  defHttp.put({ url: '/devops/projectManagement/update', data });

// 根据ID删除项目
export const deleteProjectData = (id: any) => defHttp.delete({ url: `devops/projectManagement/delete/${id}` });

// 批量更新项目类型
export const batchProjectUpdate = (data: ProjectManagement.PutRequest) =>
  defHttp.post({ url: `/devops/projectManagement/batchUpdate`, data });
